	$(document).ready(function(){
		$('#airport-service').click(function(){
			var air_checked = 	$(this).is(':checked');
			var car_checked	=	$('#car-service').is(':checked');
			if(air_checked == true){
				$('.air_speedup').show();
				if(car_checked == false){
					$('.total-price').html(parseFloat(total_airfast_track_fee) + parseFloat(total_visa_fee) + parseFloat(total_processing_fee) + ' USD');
				}else{
					$('.total-price').html(parseFloat(total_airfast_track_fee) + parseFloat(total_visa_fee) + parseFloat(total_processing_fee) + parseFloat(carpick_up_fee) + ' USD');
				}
				
			}else{
				$('.air_speedup').hide();
				if(car_checked == false){
					$('.total-price').html(parseFloat(total_visa_fee) + parseFloat(total_processing_fee) + ' USD');
				}else{
					$('.total-price').html(parseFloat(total_visa_fee) + parseFloat(total_processing_fee) + parseFloat(carpick_up_fee) + ' USD');
				}
			}
		});
		
		$('#car-service').click(function(){
			var car_checked = 	$(this).is(':checked');
			var air_checked	=	$('#airport-service').is(':checked');
			if(car_checked == true){
				$('.car_pickup').show();
				if(air_checked == false){
					$('.total-price').html(parseFloat(total_visa_fee) + parseFloat(total_processing_fee) + parseFloat(carpick_up_fee) + ' USD');
				}else{
					$('.total-price').html(parseFloat(total_airfast_track_fee) + parseFloat(total_visa_fee) + parseFloat(total_processing_fee) + parseFloat(carpick_up_fee) + ' USD');
				}
			}else{
				$('.car_pickup').hide();
				if(air_checked == false){
					$('.total-price').html(parseFloat(total_visa_fee) + parseFloat(total_processing_fee) + ' USD');
				}else{
					$('.total-price').html(parseFloat(total_airfast_track_fee) + parseFloat(total_visa_fee) + parseFloat(total_processing_fee) + ' USD');
				}
			}
		});
		
		
		$("#note2").click(function(){
			$("#tip_note_2").show();
			$(this).parent().find("div").css("display","block");
		});
		
		$("#note3").click(function(){
			$("#tip_note_3").show();
			$(this).parent().find("div").css("display","block");
		});
		
		$("#note4").click(function(){
			$("#tip_note_4").show();
			$(this).parent().find("div").css("display","block");
		});
		
		$("#note5").click(function(){
			$("#tip_note_5").show();
			$(this).parent().find("div").css("display","block");
		});
		
		$(".change_customer").click(function(){
			$("#customer_changing").css("display","block");
			$("#fade").css("display","block");
			
			$.post(
					base_url+'apply/change_date_exit_ceiling/',
					{date_arrival:$("#change_arrival_date").val(), type_of_visa: type_visa},
					function(data){
						$("#change_exit_ceiling").html(data);
					}
			);
			
			$.post(
					base_url+'apply/change_date_exit_floor/',
					{date_arrival:$("#change_arrival_date").val()},
					function(data){
						$("#change_exit_floor").html(data);
					}
			);
			
			$("#change_arrival_date").change(function(){
				$.post(
						base_url+'apply/change_date_exit_ceiling/',
						{date_arrival:$("#change_arrival_date").val(), type_of_visa: type_visa},
						function(data){
							$("#change_exit_ceiling").html(data);
						}
				);
				
				$.post(
						base_url+'apply/change_date_exit_floor/',
						{date_arrival:$("#change_arrival_date").val()},
						function(data){
							$("#change_exit_floor").html(data);
						}
				);
			});
			
			$(".save_customer").click(function(){
				//$("#ajax-loader").css("display","block");
				//$("#ajax-loader").css("left",$("#light").width()/2-20+"px");
				$.post(
						base_url+'apply/change_contact_info/',
						{
							date_arrival	:$("#change_arrival_date").val(),
							date_exit		:$("#change_exit_date").val(),
							arrival_port 	:$("#change_arrival_port").val(),
							flight_number	:$("#change_flight_number").val(),
							rush_service	:$(".change_rush_service:checked").val(),
							customer_id		:$("#customer_id_hidden").val()
						},
						function(data){
							//$("#ajax-loader").css("display","none");
							//$("#light").css("display","none");
							//$("#fade").css("display","none");
							//$("#hehe").html(data);
							window.location = location.href;
								
						}
						
				);

			});
		});
		
		
		
		$(".change_applicant").click(function(){
			var id = $(this).attr("id");
			
			$("#applicant_changing").css("display","block");
			$("#fade").css("display","block");
			$(".change_title_appl").html('<span class="applicant_icon">Applicant '+$(".applicant_order_"+$(this).attr("id")).html()+'</span>' );
			$(".change_full_name").val($(".applicant_name_"+$(this).attr("id")).html());
			$(".change_birth_date").val($(".applicant_birth_"+$(this).attr("id")).html());
			$(".change_nationality").val($(".applicant_nationality_"+$(this).attr("id")).html());
			$(".change_passport_number").val($(".applicant_passport_"+$(this).attr("id")).html());
			$(".change_expiration_pass").val($(".applicant_expiration_"+$(this).attr("id")).html());
			$(".change_gender").val($(".applicant_gender_"+$(this).attr("id")).html());
			$(".changing_apply_id").html('<input type="hidden" value="'+id+'" name="apply_id" />');
			
			$(".save_applicant").click(function(){
				//$("#ajax-loader").css("display","block");
				//$("#ajax-loader").css("left",$("#light").width()/2-20+"px");
				$.post(
						base_url+'apply/change_apply_info/',
						{
							fullname	: $(".change_full_name").val(),
							birthdate	: $(".change_birth_date").val(),
							nationality	: $(".change_nationality").val(),
							passport_num: $(".change_passport_number").val(),
							expiration	: $(".change_expiration_pass").val(),
							gender		: $(".change_gender").val(),
							apply_id	: id
						},
						function(data){
							//$("#ajax-loader").css("display","none");
							//$("#light").css("display","none");
							//$("#fade").css("display","none");
							window.location = location.href;
						}
				);
			});
			
		});
		
		
		
		
		
	});